package com.liruo.learn.spring.mybatis.cmp;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;

import java.util.Date;

/**
 * @Author:liruo
 * @Date:2023-03-03-15:30:27
 * @Desc
 */
public class BaseFill implements MetaObjectHandler{
    @Override
    public void insertFill(MetaObject metaObject) {
        Date now = new Date();
        this.strictInsertFill(metaObject, "created", Date.class, now);
        this.strictInsertFill(metaObject, "updated", Date.class, now);
//        this.setFieldValByName("updated", milli, metaObject);
    }

    @Override
    public void updateFill(MetaObject metaObject) {
        Date now = new Date();
        this.strictUpdateFill(metaObject, "updated", Date.class, now);
    }
}
